﻿using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;

namespace AutoCadConvert
{
    public class Space : BspObject
    {
        public string Name;
        public Point m_Point;
        //public Color Color;
        //public bool ShowName;
        //public bool IsCreateSkirtingLine = true;//是否有踢脚线
        //public bool IsCreateTopLine = true;//是否有吊顶
        //public Entity m_Text;

        public Space()
        {

        }
    }

    public class Spaces: Collection
    {
        List<Space> m_Space = new List<Space>();
        public Spaces(House house):base(house)
        {
            
        }
        public override void AddData(Entity value)
        {
            base.AddData(value);
            if (value is DBText)
            {
                DBText text = value as DBText;
                m_Space.Add(new Space()
                {
                    Name = text.TextString,
            });
                
            }
            else if(value is MText)
            {
                MText text = value as MText;
                m_Space.Add(new Space()
                {
                    Name = text.Contents,
                });
            }
        }
        public override void AjustLineAndPoint()
        {
            
        }
        public override IEnumerable<XElement> ToXml()
        {
            foreach (Space sp in m_Space)
                yield return new XElement("_" + m_Space.IndexOf(sp), sp.ToXml());
        }
    }
}
